#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 3e5 + 5;

int n, m, c, d, tot;
int a[N], sum[N];
int f[45][N], g[45][N];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> c >> d;
  tot = n * c + m;
  rep(i, 1, tot) cin >> a[i];
  n++, tot++;
  rep(i, 1, tot + c - 1) sum[i] = sum[i - 1] + a[i];
  rep(i, 1, d + 1) f[1][i] = sum[i + c - 1] - sum[i], g[1][i] = 0;
  rep(i, 2, n) {
    int mn0 = min(tot, (i - 2) * c + 1);
    int mx0 = min(tot, (i - 2) * (c + d) + d + 1);
    int mn1 = min(tot, (i - 1) * c + 1);
    int mx1 = min(tot, (i - 1) * (c + d) + d + 1);
    deque<int> dq;
    int pos = mn0;
    rep(j, mn1, mx1) {
      int l = max(mn0, j - c - d), r = min(mx0, j - c);
      while (pos <= r) {
        while (dq.size() && f[i - 1][dq.back()] >= f[i - 1][pos]) dq.pop_back();
        dq.push_back(pos++);
      }
      while (dq.size() && dq.front() < l) dq.pop_front();
      f[i][j] = sum[j + c - 1] - sum[j] + f[i - 1][dq.front()];
      g[i][j] = dq.front();
      // cout << i - 1 << ',' << dq.front() << "->" << i << ',' << j << endl;
    }
  }
  cout << sum[tot] - f[n][tot] << endl;
  vector<int> ans;
  int p = tot;
  per(i, n, 2) {
    p = g[i][p];
    ans.push_back(p);
  }
  reverse(ans.begin(), ans.end());
  for (int x : ans) cout << x << ' ';
  return 0;
}